package cn.zhaoyuening.chat_common.msg;

import java.io.Serializable;

/**
 * Created by Buynow on 2017/6/14.
 */
public class ResultMsg extends BaseMsg implements Serializable {
    private boolean isSuccess;
    private String info;

    public ResultMsg() {
        setType(MsgType.RESULT);
    }

    public static ResultMsg success(String info) {
        ResultMsg resultMsg = new ResultMsg();
        resultMsg.setSuccess(true);
        resultMsg.setInfo(info);
        return resultMsg;
    }

    public static ResultMsg success() {
        return ResultMsg.success(null);
    }

    public static ResultMsg fail(String info) {
        ResultMsg resultMsg = new ResultMsg();
        resultMsg.setSuccess(false);
        resultMsg.setInfo(info);
        return resultMsg;
    }

    public static ResultMsg fail() {
        return ResultMsg.fail(null);
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

}
